package day7;

import java.util.Scanner;

/**
 * @author oldliu
 * @since 1.0
 */
public class DelArray {
    public static void main(String[] args) {
        String[] a = {"apple", "pig", "dog", "banana", "orange"};
        Scanner in = new Scanner(System.in);
        System.out.println("要删除谁！？");
        String d = in.next();
        for (int i = 0; i < a.length; i++) {
            if (a[i].equals(d)) {
                for (int j = i; j < a.length - 1; j++) {
                    a[j] = a[j + 1];
                }
                a[a.length - 1] = null;//最后一个置空
                break;
            }
        }
        for (int i = 0; i < a.length; i++) {
            System.out.print(a[i] + "\t");
        }
    }
}
